"use strict";(self.webpackChunkpromptmanager=self.webpackChunkpromptmanager||[]).push([[3967],{72115:function(e,n,t){t.d(n,{Z:function(){return c}});t(72791);var i=t(20068),s=t(13400),r=t(87569),a=t(14665),o=t(4152),l=t(2216),p=t(80184);function c(e){var n=e.visibility,t=e.published,c=e.setShowSharingModal,d=void 0===c?function(){}:c,u=e.disabled,x=void 0!==u&&u,h=t&&!x?"success":"gray",f="";return 3===n?f="Publicly accessible":2===n?f="Anyone with the link can access":1===n?f="Accessible by anyone in your organization":0===n&&(f="Only selected users and you can access"),t||(f="Not published"),(0,p.jsx)(i.Z,{title:f,children:(0,p.jsxs)(s.Z,{onClick:function(){return d(!0)},sx:{padding:"0px"},disabled:x,children:[3===n&&(0,p.jsx)(r.Z,{color:h,fontSize:"small"}),2===n&&(0,p.jsx)(a.Z,{color:h,fontSize:"small"}),1===n&&(0,p.jsx)(o.Z,{color:h,fontSize:"small"}),0===n&&(0,p.jsx)(l.Z,{color:h,fontSize:"small"})]})})}},7077:function(e,n,t){t.d(n,{o:function(){return r}});var i=t(11912),s=t(58518),r=function(){var e=i.Z.create({xsrfCookieName:"csrftoken",xsrfHeaderName:"X-CSRFToken"});return e.interceptors.response.use((function(e){return e}),(function(e){return window.location.pathname.startsWith("/s/")||window.location.pathname.startsWith("/hub")||window.location.pathname.startsWith("/app/")||401!==e.response.status&&403!==e.response.status||(window.location.href="/login"),(0,s.yv)("Error Occurred",{variant:"error"}),Promise.reject(e)})),e}},33967:function(e,n,t){t.r(n),t.d(n,{default:function(){return Y}});var i=t(72791),s=t(89164),r=t(64554),a=t(20890),o=t(29439),l=t(57621),p=t(39504),c=t(53767),d=t(57689),u=t(7077),x=t(5289),h=t(65661),f=t(39157),g=t(51691),m=t(48550),Z=t(97123),j=t(24518),v=t(80184);function y(e){var n=e.open,t=e.setOpen,i=e.appName,s=e.setAppName,r=e.createApp,o=e.preText,l=void 0===o?null:o,p=function(){t(!1)};return(0,v.jsxs)(x.Z,{open:n,onClose:p,children:[(0,v.jsx)(h.Z,{children:"Create a New App"}),(0,v.jsxs)(f.Z,{children:[(0,v.jsxs)(g.Z,{children:[l,(0,v.jsx)(a.Z,{style:{paddingTop:5,fontSize:"18px"},children:"To begin creating your application, please provide a name."})]}),(0,v.jsx)(m.Z,{autoFocus:!0,margin:"dense",id:"name",label:"App name",type:"text",fullWidth:!0,variant:"standard",value:i,required:!0,onChange:function(e){return s(e.target.value)}})]}),(0,v.jsxs)(Z.Z,{children:[(0,v.jsx)(j.Z,{onClick:p,sx:{textTransform:"none"},children:"Cancel"}),(0,v.jsx)(j.Z,{onClick:r,variant:"contained",sx:{textTransform:"none"},children:"Create App"})]})]})}function b(){var e=(0,i.useState)([]),n=(0,o.Z)(e,2),t=n[0],s=n[1],r=(0,i.useState)(null),x=(0,o.Z)(r,2),h=x[0],f=x[1],g=(0,i.useState)("Untitled"),m=(0,o.Z)(g,2),Z=m[0],j=m[1],b=(0,i.useState)(!1),A=(0,o.Z)(b,2),_=A[0],C=A[1],S=(0,d.s0)();return(0,i.useEffect)((function(){(0,u.o)().get("/api/app_types").then((function(e){s(e.data.filter((function(e){return"web"===e.slug||"text-chat"===e.slug})))}))}),[s]),(0,v.jsxs)("div",{style:{display:"flex",gap:15},children:[(0,v.jsx)(y,{open:_,setOpen:C,appName:Z,setAppName:j,createApp:function(){var e={app_type:h.id,name:Z||"Untitled",description:"New Promptly App",config:{},input_schema:{},app_input_schema:{},processors:[]};(0,u.o)().post("/api/apps",e).then((function(e){var n=e.data.uuid;S("/apps/".concat(n))}))}}),t.map((function(e,n){return(0,v.jsx)("div",{children:(0,v.jsx)(l.Z,{sx:{width:200,height:150,cursor:"pointer"},onClick:function(){f(e),C(!0)},children:(0,v.jsx)(p.Z,{children:(0,v.jsxs)(c.Z,{direction:"column",spacing:1,children:[(0,v.jsx)(a.Z,{variant:"subtitle1",color:"text.secondary",style:{fontFamily:"Lato, sans-serif",fontWeight:"bold"},children:e.name}),(0,v.jsx)(a.Z,{variant:"body2",color:"text.secondary",children:e.description})]})})})},n)}))]})}var A=t(94070),_=t(35527),C=t(39281),S=t(79836),w=t(56890),k=t(35855),T=t(53994),P=t(53382),W=t(81918),z=t(67492),E=t(60383),N=t(72115),O=function(e){var n=e.open,t=e.setOpen,s=e.appId,r=(0,i.useState)(""),a=(0,o.Z)(r,2),l=a[0],p=a[1],c=function(){t(!1)};return(0,v.jsx)("div",{children:(0,v.jsxs)(x.Z,{open:n,onClose:c,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,v.jsx)(h.Z,{id:"alert-dialog-title",children:"Delete App"}),(0,v.jsxs)(f.Z,{children:[(0,v.jsx)(g.Z,{id:"alert-dialog-description",children:(0,v.jsx)(A.Z,{severity:"warning",children:"Are you sure you want to delete this app? This action cannot be undone."})}),(0,v.jsx)(m.Z,{autoFocus:!0,margin:"dense",id:"name",label:"DELETE",placeholder:"Type DELETE to confirm",type:"text",fullWidth:!0,variant:"standard",value:l,required:!0,onChange:function(e){return p(e.target.value)}})]}),(0,v.jsxs)(Z.Z,{children:[(0,v.jsx)(j.Z,{onClick:c,variant:"outlined",style:{textTransform:"none"},children:"Cancel"}),(0,v.jsx)(j.Z,{onClick:function(){(0,u.o)().delete("/api/apps/".concat(s)).then((function(e){t(!1),window.location.reload()}))},variant:"contained",style:{textTransform:"none"},disabled:"DELETE"!==l,children:"Delete"})]})]})})},B=function(e){var n=e.open,t=e.setOpen,i=function(){t(!1)};return(0,v.jsx)("div",{children:(0,v.jsxs)(x.Z,{open:n,onClose:i,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[(0,v.jsx)(h.Z,{id:"alert-dialog-title",children:"Failed to Delete App"}),(0,v.jsx)(f.Z,{children:(0,v.jsx)(g.Z,{id:"alert-dialog-description",children:(0,v.jsx)(A.Z,{severity:"error",children:"You cannot delete a published app. Please unpublish the app first."})})}),(0,v.jsx)(Z.Z,{children:(0,v.jsx)(j.Z,{onClick:i,variant:"contained",style:{textTransform:"none"},children:"Okay"})})]})})};function R(){var e=(0,i.useState)(0),n=(0,o.Z)(e,2),t=n[0],s=n[1],r=(0,i.useState)([]),a=(0,o.Z)(r,2),l=a[0],p=a[1],c=(0,i.useState)(10),x=(0,o.Z)(c,2),h=x[0],f=x[1],g=(0,i.useState)(!1),m=(0,o.Z)(g,2),Z=m[0],j=m[1],y=(0,i.useState)(!1),b=(0,o.Z)(y,2),A=b[0],R=b[1],L=(0,i.useState)(""),q=(0,o.Z)(L,2),D=q[0],F=q[1],I=(0,d.s0)();(0,i.useEffect)((function(){(0,u.o)().get("/api/apps?fields=uuid,name,visibility,is_published,app_type_name,unique_processors").then((function(e){p(e.data)}))}),[p]);return(0,v.jsxs)(_.Z,{sx:{width:"100%"},children:[(0,v.jsx)(C.Z,{children:(0,v.jsxs)(S.Z,{children:[(0,v.jsx)(w.Z,{children:(0,v.jsxs)(k.Z,{sx:{backgroundColor:"#f0f7ff"},children:[(0,v.jsx)(T.Z,{sx:{padding:"3px 16px"},children:"App Name"}),(0,v.jsx)(T.Z,{sx:{padding:"3px 16px",textAlign:"center"},children:"App Type"}),(0,v.jsx)(T.Z,{sx:{padding:"3px 16px",textAlign:"center"},children:"Visibility"}),(0,v.jsx)(T.Z,{sx:{padding:"3px 16px"},children:"Processors"}),(0,v.jsx)(T.Z,{sx:{padding:"3px 16px"},children:"Delete"})]})}),(0,v.jsx)(P.Z,{children:l.slice(t*h,t*h+h).map((function(e){var n;return(0,v.jsxs)(k.Z,{hover:!0,onClick:function(){return I("/apps/".concat(e.uuid))},sx:{cursor:"pointer"},children:[(0,v.jsx)(T.Z,{children:e.name}),(0,v.jsx)(T.Z,{sx:{textAlign:"center"},children:e.app_type_name}),(0,v.jsx)(T.Z,{sx:{textAlign:"center"},children:(0,v.jsx)(N.Z,{visibility:e.visibility,published:e.is_published})}),(0,v.jsx)(T.Z,{style:{maxWidth:"100px"},children:null===(n=e.unique_processors)||void 0===n?void 0:n.map((function(e){return(0,v.jsx)(W.Z,{label:e,size:"small"},e)}))}),(0,v.jsx)(T.Z,{children:(0,v.jsx)(E.Z,{style:{color:e.is_published?"#ccc":"#d5847e"},onClick:function(n){n.stopPropagation(),e.is_published?j(!0):(F(e.uuid),R(!0))}})})]},e.uuid)}))})]})}),(0,v.jsx)(z.Z,{rowsPerPageOptions:[10,25,50],component:"div",count:l.length,rowsPerPage:h,page:t,onPageChange:function(e,n){s(n)},onRowsPerPageChange:function(e){f(parseInt(e.target.value,10)),s(0)}}),(0,v.jsx)(B,{open:Z,setOpen:j}),(0,v.jsx)(O,{open:A,setOpen:R,appId:D})]})}var L=t(1413),q=t(93433);function D(e){var n,t=e.open,i=e.setOpen,s=e.appName,r=e.setAppName,o=e.createApp,l=e.appTemplate,p=function(){i(!1)};return(0,v.jsxs)(x.Z,{open:t,onClose:p,children:[(0,v.jsxs)(f.Z,{children:[(0,v.jsx)(a.Z,{style:{paddingTop:5,fontSize:"20px",fontWeight:500},children:null===l||void 0===l?void 0:l.name}),(0,v.jsxs)(a.Z,{style:{paddingTop:10,fontSize:"14px",color:"#555"},children:[null===l||void 0===l?void 0:l.description,(null===l||void 0===l?void 0:l.example_app_uuid)&&" Try it out ",(null===l||void 0===l?void 0:l.example_app_uuid)&&(0,v.jsx)("a",{href:"https://trypromptly.com/app/".concat(null===l||void 0===l?void 0:l.example_app_uuid),target:"_blank",rel:"noreferrer",children:"here"})]}),(0,v.jsx)(c.Z,{gap:.5,direction:"row",mt:2,children:null===l||void 0===l||null===(n=l.categories)||void 0===n?void 0:n.map((function(e,n){return(0,v.jsx)(W.Z,{label:null===e||void 0===e?void 0:e.name,variant:"outlined",size:"small",sx:{borderRadius:"5px"}},n)}))}),(0,v.jsx)(a.Z,{style:{paddingTop:20,paddingBottom:5,fontSize:"16px"},children:"To begin creating your application, please provide a name."}),(0,v.jsx)(m.Z,{autoFocus:!0,margin:"dense",id:"name",label:"App name",type:"text",fullWidth:!0,variant:"standard",value:s,required:!0,onChange:function(e){return r(e.target.value)}})]}),(0,v.jsxs)(Z.Z,{children:[(0,v.jsx)(j.Z,{onClick:p,sx:{textTransform:"none"},children:"Cancel"}),(0,v.jsx)(j.Z,{onClick:o,variant:"contained",sx:{textTransform:"none"},children:"Create App"})]})]})}function F(){var e=(0,i.useState)("Untitled"),n=(0,o.Z)(e,2),t=n[0],s=n[1],r=(0,i.useState)([]),x=(0,o.Z)(r,2),h=x[0],f=x[1],g=(0,i.useState)(!1),m=(0,o.Z)(g,2),Z=m[0],j=m[1],y=(0,i.useState)(null),b=(0,o.Z)(y,2),A=b[0],_=b[1],C=(0,d.UO)().appTemplateSlug,S=(0,d.s0)(),w=(0,i.useCallback)((function(e){var n=h.find((function(n){return n.slug===e}));n&&(s(n.name),n.app?_(n):(0,u.o)().get("/api/apps/templates/".concat(e)).then((function(n){_(n.data),f((function(t){var i=(0,q.Z)(t),s=i.findIndex((function(n){return n.slug===e}));return i[s]=n.data,i}))})))}),[h]);(0,i.useEffect)((function(){C&&(w(C),j(!0))}),[C,w]);return(0,i.useEffect)((function(){(0,u.o)().get("/api/apps/templates").then((function(e){f(e.data)}))}),[f]),(0,v.jsxs)(c.Z,{gap:1,children:[(0,v.jsx)(D,{appName:t,setAppName:s,createApp:function(){var e,n,i=(0,L.Z)((0,L.Z)({},A.app||{}),{},{name:t||(null===A||void 0===A?void 0:A.name)||"Untitled",app_type:null===(e=A.app)||void 0===e?void 0:e.type,app_type_slug:null===(n=A.app)||void 0===n?void 0:n.type_slug,template_slug:A.slug});(0,u.o)().post("/api/apps",i).then((function(e){var n=e.data.uuid;S("/apps/".concat(n))}))},open:Z,setOpen:j,appTemplate:A}),(0,v.jsx)(a.Z,{color:"text.secondary",sx:{textAlign:"left",fontSize:"16px",margin:"5px"},children:"Use one of our app templates to get started quickly. You can customize it using our visual editor."}),(0,v.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:15},children:h.map((function(e,n){var t;return(0,v.jsx)("div",{style:{maxWidth:"300px",cursor:"pointer"},onClick:function(){S("/apps/templates/".concat(e.slug))},children:(0,v.jsx)(l.Z,{sx:{width:200,height:150,display:"flex",justifyContent:"center",alignItems:"baseline"},children:(0,v.jsx)(p.Z,{sx:{padding:"10px"},children:(0,v.jsxs)(c.Z,{direction:"column",spacing:1,children:[(0,v.jsx)(a.Z,{variant:"subtitle1",color:"text.secondary",style:{fontFamily:"Lato, sans-serif",fontWeight:"bold"},children:e.name}),(0,v.jsx)(a.Z,{variant:"caption",color:"text.secondary",children:e.description||(null===(t=e.app)||void 0===t?void 0:t.type.description)})]})})})},n)}))})]})}var I=t(1428);function U(){var e=(0,i.useState)(0),n=(0,o.Z)(e,2),t=n[0],s=n[1],r=(0,i.useState)([]),a=(0,o.Z)(r,2),l=a[0],p=a[1],c=(0,i.useState)(10),x=(0,o.Z)(c,2),h=x[0],f=x[1],g=(0,d.s0)();(0,i.useEffect)((function(){(0,u.o)().get("/api/apps/shared?fields=uuid,name,visibility,is_published,app_type_name,owner_email,published_uuid,access_permission,unique_processors").then((function(e){p(e.data)}))}),[p]);return(0,v.jsxs)(_.Z,{sx:{width:"100%"},children:[(0,v.jsx)(C.Z,{children:(0,v.jsxs)(S.Z,{children:[(0,v.jsx)(w.Z,{children:(0,v.jsxs)(k.Z,{sx:{backgroundColor:"#f0f7ff"},children:[(0,v.jsx)(T.Z,{sx:{padding:"3px 16px"},children:"App Name"}),(0,v.jsx)(T.Z,{sx:{padding:"3px 16px",textAlign:"center"},children:"App Type"}),(0,v.jsx)(T.Z,{sx:{padding:"3px 16px",textAlign:"center"},children:"Owner"}),(0,v.jsx)(T.Z,{sx:{padding:"3px 16px"},children:"Processors"}),(0,v.jsx)(T.Z,{sx:{padding:"3px 16px",textAlign:"center"},children:"Can Edit?"})]})}),(0,v.jsx)(P.Z,{children:l.slice(t*h,t*h+h).map((function(e){var n;return(0,v.jsxs)(k.Z,{hover:!0,onClick:function(){return g((null===e||void 0===e?void 0:e.access_permission)>0?"/apps/".concat(e.uuid):"/app/".concat(e.published_uuid))},sx:{cursor:"pointer"},children:[(0,v.jsx)(T.Z,{children:e.name}),(0,v.jsx)(T.Z,{sx:{textAlign:"center"},children:e.app_type_name}),(0,v.jsx)(T.Z,{sx:{textAlign:"center"},children:e.owner_email}),(0,v.jsx)(T.Z,{style:{maxWidth:"100px"},children:null===(n=e.unique_processors)||void 0===n?void 0:n.map((function(e){return(0,v.jsx)(W.Z,{label:e,size:"small"},e)}))}),(0,v.jsx)(T.Z,{sx:{textAlign:"center"},children:(null===e||void 0===e?void 0:e.access_permission)>0&&(0,v.jsx)(I.Z,{color:"success"})})]},e.uuid)}))})]})}),(0,v.jsx)(z.Z,{rowsPerPageOptions:[10,25,50],component:"div",count:l.length,rowsPerPage:h,page:t,onPageChange:function(e,n){s(n)},onRowsPerPageChange:function(e){f(parseInt(e.target.value,10)),s(0)}})]})}var Y=function(){return(0,v.jsxs)(s.Z,{maxWidth:"md",style:{minWidth:"100%",padding:5},children:[(0,v.jsxs)(r.Z,{style:{marginTop:"5px",marginBottom:"20px"},children:[(0,v.jsx)(a.Z,{variant:"h6",style:{textAlign:"left",marginBottom:"10px",padding:"5px 10px",fontWeight:600,borderRadius:"5px",color:"#1c3c5a",fontSize:"18px",borderBottom:"solid 3px #1c3c5a",borderLeft:"solid 1px #ccc",borderRight:"solid 1px #ccc"},children:"Quickstart App Templates"}),(0,v.jsx)(F,{})]}),(0,v.jsxs)(r.Z,{style:{marginBottom:"20px"},children:[(0,v.jsx)(a.Z,{variant:"h6",style:{textAlign:"left",marginBottom:"10px",padding:"5px 10px",fontWeight:600,borderRadius:"5px",color:"#1c3c5a",fontSize:"18px",borderBottom:"solid 3px #1c3c5a",borderLeft:"solid 1px #ccc",borderRight:"solid 1px #ccc"},children:"Create a new App from scratch"}),(0,v.jsx)(b,{})]}),(0,v.jsxs)(r.Z,{style:{marginBottom:"20px"},children:[(0,v.jsx)(a.Z,{variant:"h6",style:{textAlign:"left",marginBottom:"10px",padding:"5px 10px",fontWeight:600,borderRadius:"5px",color:"#1c3c5a",fontSize:"18px",borderBottom:"solid 3px #1c3c5a",borderLeft:"solid 1px #ccc",borderRight:"solid 1px #ccc"},children:"Your Apps"}),(0,v.jsx)(R,{})]}),(0,v.jsxs)(r.Z,{style:{marginBottom:"20px"},children:[(0,v.jsx)(a.Z,{variant:"h6",style:{textAlign:"left",marginBottom:"10px",padding:"5px 10px",fontWeight:600,borderRadius:"5px",color:"#1c3c5a",fontSize:"18px",borderBottom:"solid 3px #1c3c5a",borderLeft:"solid 1px #ccc",borderRight:"solid 1px #ccc"},children:"Apps Shared With You"}),(0,v.jsx)(U,{})]})]})}}}]);
//# sourceMappingURL=3967.3f8e73f2.chunk.js.map